package Temp.杂乱无章;

import java.util.Scanner;

public class 蛇行矩阵 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int a = 1, b = 1, c;
        for (int i = 1; i <= n; i++) {
            b = a;
            a = a + i;
            c = i + 1;
            for (int j = i; j <= n; j++) {
                if (j == n) {
                    System.out.println(b);
                } else {
                    System.out.print(b + " ");
                }
                b += c;
                c++;
            }
        }
    }
}
